package com.quanshu.exchange.ui.gui.message.chat.row.viewholder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.hyphenate.chat.EMMessage;
import com.hyphenate.chat.EMVideoMessageBody;
import com.quanshu.exchange.R;
import com.quanshu.exchange.ui.gui.message.chat.row.BaseChatRowViewHolder;
import com.quanshu.exchange.ui.gui.message.chat.row.ChatImageUtil;

// 接收视频消息ViewHolder
public class VideoReceiveViewHolder extends BaseChatRowViewHolder {
    ImageView image;
    LinearLayout loading;

    public VideoReceiveViewHolder(Context context, View view) {
        super(context, view);
        image = view.findViewById(R.id.chat_video_img);
        loading = view.findViewById(R.id.ll_loading);
    }

    @Override
    public void setViewInfo(EMMessage chatMessage, EMMessage preMessage, String groupOwner) {
        super.setViewInfo(chatMessage, preMessage, groupOwner);
        EMVideoMessageBody videoBody = (EMVideoMessageBody) chatMessage.getBody();
        String localThumb = videoBody.getLocalThumb();
        // 设置内容
        loading.setVisibility(View.GONE);
        ChatImageUtil.showFromVideoView(localThumb, image, chatMessage, context);
    }
}